

from base import Base
from selenium.webdriver.common.by import By
from time import sleep

# 定义页面类，继承基类
class XiaChuFangPage(Base):

    sosuokuang = 'new UiSelector().text("搜索菜谱")'
    shurukuang = (By.ID, 'com.xiachufang:id/search_edit_text')
    sosuoanniu = (By.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[3]/android.widget.TextView')
    dy = (By.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/androidx.recyclerview.widget.RecyclerView/android.widget.TextView[2]')

    def sosuoyewu(self, neirong):
        self.find_ele(self.sosuokuang).click()
        sleep(2)
        self.find_ele(self.shurukuang).send_keys(neirong)
        sleep(2)
        self.find_ele(self.sosuoanniu).click()
        sleep(3)